home *** CD-ROM | disk | FTP | other *** search
-
-
-
- EXEC(3) MINTLIB LIBRARY FUNCTIONS EXEC(3)
-
-
- N✓NA✓AM✓ME✓E
- execl, execv, execle, execlp, execve, execvp - execute a
- file
-
- S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
- #include <unistd.h>
-
- int execl(char *path, ...);
-
- int execv(char *path, char *argv[]);
-
- int execle(char *path, ...);
-
- int execlp(char *file, ...);
-
- int execve(char *path, char *argv[], char *envp[]);
-
- int execvp(char *file, char *argv[]);
-
- D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
- These routines transform the calling process into a new
- process. The program indicated by `path' or `file' is
- loaded, then run. There can be no return from a succesful
- exec call.
-
- These calls differ in the following ways:
- - execl, execle and execlp are called when the number of
- arguments is known in advance, whereas execv, execve
- and execvp take an argument vector.
-
- - execl, execv, execle and execve are called with the full
- path name of the program to be run, whereas execlp and
- execvp are called with a filename that is searched on
- the user's search path and that may be extended with
- the filename extensions ".ttp", ".tos" and ".prg".
-
- - execl, execv, execlp and execvp pass the parent's
- environment to the new process, whereas execle and
- execve take a pointer to an environment vector as
- their final argument.
-
- The last argument to the execl, execle and execlp func-
- tions should be a NULL pointer.
-
- An argument vector argv as used in execv, execve and
- execvp is a pointer to a null-terminated array of charac-
- ter pointers to null-terminated character strings. These
- strings constitute the argument list to be made available
- to the new process. By convention, at least one argument
- must be present in this array, and the first element of
- this array should be the name of the executed program. For
- execv and execve this is the last component of the path
- argument; for execvp this is the file argument.
-
-
-
-
- MiNT docs 0.1 3 March 1993 1
-
-
-
-
-
- EXEC(3) MINTLIB LIBRARY FUNCTIONS EXEC(3)
-
-
- The environment vector envp as used in execle and execve
- is also a pointer to a null-terminated array of character
- pointers to null-terminated strings. These strings pass
- information to the new process which are not directly
- arguments to the command. If envp is NULL, a copy of the
- parent process' environment is passed.
-
- Signals set to the default action (SIG_DFL) in the calling
- process image are set to the default action in the new
- process. Signals set to be ignored (SIG_IGN) by the call-
- ing process are ignored by the new process. Signals set to
- be caught by the calling process are reset to the default
- action in the new process. Signals set to be blocked in
- the calling process remain blocked in the new process,
- regardless of changes to the signal action.
-
- R✓RE✓ET✓TU✓UR✓RN✓N V✓VA✓AL✓LU✓UE✓ES✓S
- These functions returns to the calling process only on
- failure, for instance if the program called could not be
- found, if it was not executable, or if not enough memory
- was available, in which case -1 is returned and errno is
- set to indicate the error.
-
- E✓EX✓XA✓AM✓MP✓PL✓LE✓ES✓S
- This will execute the program /bin/date or fail:
- execl("/bin/date", "date", NULL);
-
- This will search the program sh and then execute it;
- it will fail only if sh, sh.tos, sh.ttp and sh.prg
- could not be found:
- execlp("sh", "sh", "-c", commandline, NULL);
-
- This will call /bin/test using an already constructed
- argument vector and an already constructed environment
- vector, and fail if /bin/test could not be found:
- execve("/bin/test", my_argv, my_envp);
-
- S✓SE✓EE✓E A✓AL✓LS✓SO✓O
- f✓fo✓or✓rk✓k(✓(3✓3)✓),✓, s✓si✓ig✓gn✓na✓al✓l(✓(3✓3)✓),✓, t✓tf✓fo✓or✓rk✓k(✓(3✓3)✓),✓, v✓vf✓fo✓or✓rk✓k(✓(3✓3)✓),✓, _✓_s✓sp✓pa✓aw✓wn✓nv✓ve✓e(✓(3✓3)✓)
-
- N✓NO✓OT✓TE✓ES✓S
- When MiNT is not active, these library calls call a child
- process and then _exit after the child has finished; only
- when MiNT is active, the current process is truly trans-
- formed into a new one.
-
- On Un*x, execve is a system call, while the rest of these
- calls are library routines. Under MiNT, it's all done in
- the library.
-
-
-
-
-
-
-
-
- MiNT docs 0.1 3 March 1993 2
-
-
-